{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Clojupyter Demo\n",
    "\n",
    "This example notebook is from the [Clojupyter](https://github.com/clojupyter/clojupyter/blob/1637f6b2557f01db1e35bae5389bc38522eefe9a/examples/html-demo.ipynb) project.",
    "\n",
    "This notebook demonstrates some of the more advanced features of Clojupyter."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Displaying HTML\n",
    "\n",
    "To display HTML, you'll need to require a clojupyter helper function to change the cell output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "(require '[clojupyter.misc.display :as display])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ">> should print some text\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<ul><li>a <i>emphatic</i> idea</li><li>a <b>bold</b> idea</li><li>an <span style=\"text-decoration: underline;\">important</span> idea</li></ul>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(println \">> should print some text\")\n",
    ";; displaying html\n",
    "(display/hiccup-html \n",
    "    [:ul \n",
    "     [:li \"a \" [:i \"emphatic\"] \" idea\"]\n",
    "     [:li \"a \" [:b \"bold\"] \" idea\"]\n",
    "     [:li \"an \" [:span {:style \"text-decoration: underline;\"} \"important\"] \" idea\"]])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can also use this to render SVG:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<svg height=\"100\" width=\"100\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"50\" cy=\"40\" fill=\"red\" r=\"40\"></circle></svg>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(display/hiccup-html\n",
    "    [:svg {:height 100 :width 100 :xmlns \"http://www.w3.org/2000/svg\"}\n",
    "            [:circle {:cx 50 :cy 40 :r 40 :fill \"red\"}]])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Adding External Clojure Dependencies \n",
    "\n",
    "You can fetch external Clojure dependcies using the `clojupyter.misc.helper` namespace. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "(require '[clojupyter.misc.helper :as helper])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "(helper/add-dependencies '[org.clojure/data.json \"0.2.6\"])\n",
    "(require '[clojure.data.json :as json])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"{\\\"a\\\":1,\\\"b\\\":[2,3],\\\"c\\\":\\\"c\\\"}\""
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(json/write-str {:a 1 :b [2, 3] :c \"c\"})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Adding External Javascript Dependency\n",
    "\n",
    "Since you can render arbitrary HTML using `display/hiccup-html`, it's pretty easy to use external Javascript libraries to do things like generate charts. Here's an example using [Highcharts](https://www.highcharts.com/).\n",
    "\n",
    "First, we use a cell to add javascript to the running notebook:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script src=\"https://code.highcharts.com/highcharts.js\"></script>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(helper/add-javascript \"https://code.highcharts.com/highcharts.js\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we define a function which takes Clojure data and returns hiccup HTML to display:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "#'user/plot-highchart"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(defn plot-highchart [highchart-json]\n",
    "  (let [id (str (java.util.UUID/randomUUID))\n",
    "        code (format \"Highcharts.chart('%s', %s );\" id, (json/write-str highchart-json))]\n",
    "      (display/hiccup-html \n",
    "        [:div [:div {:id id :style {:background-color \"red\"}}]\n",
    "                   [:script code]])))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can make generate interactive plots (try hovering over plot):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div id=\"c10e6020-3269-448a-abca-4c66e9d7ded2\" style=\"{:background-color &quot;red&quot;}\"></div><script>Highcharts.chart('c10e6020-3269-448a-abca-4c66e9d7ded2', {\"chart\":{\"type\":\"line\"},\"title\":{\"text\":\"Plot of random data\"},\"series\":[{\"data\":[504.01467712342867,3341.0920547848564,4337.721102300496,6302.792911434946,8478.835205936486,10200.680828376206,10860.870680250395,12647.535717418537,15049.206475253737,15676.723872165207,18067.461740488947,19811.340135162725,21096.880976212426,22976.421542773023,25642.573015763446,27007.92800767133,29018.359691583086,30646.762491414887,31758.620006667774,34250.99208239191,35275.00442612561,36497.80884768278,39369.70265657102,39779.62059714332,41192.8417728236,43797.79229964539,45674.65600549047,46898.57640625968,49270.696741219595,50303.10602406769,52297.24955208905,54275.213212040246,55465.3140193698,58120.32773386899,59637.312036365875,61624.67353717149,62871.769400278805,63892.08493865866,65221.515576763486,67831.50200221328,68846.74284693149,71221.87452589671,73671.13537809922,75102.92070147628,76763.12004283862,77700.8741210995,79426.30785496999,81138.75169106339,82864.90831575713,84300.33411433673,86234.14277900638,89111.33455879882,89655.59709072384,91454.31411329177,93521.50063341322,95135.77588789558,96640.86334301074,97907.3293012478,99908.3303956858,102868.48064585627,103157.91637616762,106283.89759635835,107262.16838623513,109688.15292270857,110714.79604858396,113116.02875155817,113964.73126794913,115280.31817896444,117345.58303545591,118552.3733412588,120557.49394396068,123251.90615516288,124789.74925081071,126249.04944840563,128262.72431601371,129650.54767430482,131297.77144759757,133223.09127112568,135183.65413971254,136585.97641177246,138730.64949844027,140071.0142294564,142188.29772735498,143540.29023221708,144426.11687330576,146105.16720830323,148267.88646976373,150277.81479987688,151141.09908000176,153003.3431721588,155072.9696581508,156655.92582952158,158280.3711263092,159706.54537405443,161359.93965820075,163435.42387206928,165713.3841256729,167283.85675845615,169816.06964090836,170012.91960677365,172080.8763030499,174304.03666415406,176140.11173783313,177896.17563255582,179940.15205100743,180202.76875587768,182986.08348256923,184372.46353280978,186248.80906899288,187216.41085783066,189426.07793621722,192139.7341929141,192981.21095901134,195047.64734643573,196585.76551773504,197796.7618325834,199462.148849989,201091.62102619332,204001.71219627908,205557.41101896286,206415.9047485457,208166.92222289983,209874.72017027094,211177.7886473916,214366.3229511108,214992.2379779765,217308.10540030125,218123.2817908046,221212.51686517545,221654.51601766836,223860.1572121239,225283.34538017176,228029.48196418612,229120.1730726647,231117.9829888751,233249.39160315914,234675.15545798198,235491.17818014944,238299.5227876786,239033.24656573992,240289.35829467155,242970.767737453,245091.72538878422,246296.378077813,248421.57350493365,248911.09927153058,250659.71006829522,252283.46160358287,255223.66110516613,256307.32711035621,257602.19451675512,259983.83935822253,261122.3769899618,263439.38390791597,265190.5522829674,266529.04141042416,268564.9607491242,270764.1768746787,271904.5692232761,273993.77582933835,275073.07383772836,277042.96053805883,279515.30136326957,280797.65731739113,282358.0160048534,283451.32046423934,285564.3928027838,287437.43354272,289471.4173924183,290154.5062227411,292073.7951658812,294162.58051467635,295922.49660802446,296966.7755894963,299830.0359330417,301804.8769498439,303465.4969803359,305289.9640011254,305543.01680491626,307856.9308388182,310129.0552493845,312307.66768587835,313992.7779782305,314161.62006155663,316431.02894629637,317853.2319188793,320664.7487377146,322116.02170962596,324081.70103727945,324796.15855685103,326834.70969894616,328537.6431379544,330525.30135563633,332186.6010860477,334215.02512353973,335315.63099633413,338048.4285277517,338417.288388359,340237.66093010065,341811.12370700826,343834.2252276441,346406.5210595782,346699.0851371947,349971.02414695953,351171.0547181573,352618.8091386837,353591.3556178736,356914.2098216867,357177.94570957863,359817.27074951254,361760.5309487786,363134.5593732308,365222.21748059685,367000.08764656493,367239.99817305355,370225.1635739965,371737.466197717,373040.1133099548,375166.39288538776,377502.7018259677,378650.48863657104,379390.1564232694,381031.4935702718,383400.20322317415,385981.73836711637,387460.51220380137,389410.8054731983,391036.2754409681,391619.5544203977,394427.990075115,395054.5047796959,397663.37176467397,399087.6716151541,400728.9877078095,402892.9969908024,403978.78060487506,405424.41687800223,406991.0859230373,409781.55028031784,410777.7604378193,413030.51461204246,414356.1911620559,415718.29578475223,417378.60523433704,418972.56916596764,421343.4265994993,423265.34525418637,425338.4149348379,425951.0624250249,428687.77532261447,429391.8569370728,431969.9581722627,434027.0976198394,435170.9028441315,437192.58914679487,437988.2527196529,440723.1421268008,442157.63915710396,443843.8116279504,444684.35258398036,447017.66423418646,448517.2745724615,449708.4028733435,451659.3192575042,454729.8302398158,454987.1249944543,457369.54297513445,459369.4671192174,460566.3221037852,461966.7486564694,464833.6188802792,465854.71183226135,467641.85473519086,469346.74599777046,470349.79098731995,472093.21404415276,474516.11768577533,476896.2509671359,478370.1269454932,479351.4983050216,480928.63518084225,483574.0225236888,485464.29029798065,486219.8411249944,488751.43201024225,490457.4711560733,491566.47942520044,493801.9596826314,495865.4140004851,497346.005170896,499257.6432529947,499617.8966079724,502480.0148652829,504117.75863415614,504716.95812769455,507139.48414378415,508648.9315814669,510814.0625825835,512949.1316989036,513180.8844479721,515667.6646849152,516969.94700964796,518800.3068160648,520444.44084157085,522255.0992031512,523445.5125342639,525599.1708250414,527902.4386065033,530165.5072581369,530362.1858912229,532509.3320442596,534306.3615520456,536757.1218461827,538745.6739498102,540098.1078821833,541076.8442744158,543350.826562829,544495.8578937126,546475.5755231146,548899.7583470468,550607.5252251276,552290.9182365085,552812.0687857511,554340.7338300266,556703.4004464688,558956.6588697978,559466.2609892226,561827.9053224806,562916.5387340467,566140.2979527524,566789.5563595418,568948.7864236725,570688.29495597,572412.9196529575,574363.7192463124,575377.9126242327,577484.2888392739,578742.3313398123,581345.5025248317,581857.2585007268,584077.0695911325,585724.2473988207,587550.4935976886,589223.4207645595,590897.2552354323,592546.5199258354,595352.4782291795,596618.174039029,597392.3475525079,599404.5645161764,600960.3298380218,603088.2434583401,604056.4428030935,606454.178257705,608801.7637649794,610320.0019022638,612009.7031431004,613972.6236966931,615832.252907975,616561.2871893878,617997.723154408,620732.1536209593,621353.9830547397,624039.6494815777,625459.8203307786,626708.076484846,629409.9341881764,630842.0752120106,631921.7982042093,634394.0134865238,635608.0044892109,637183.5994772052,639346.8748481671,641068.1743701512,642529.5521880708,643897.2047733518,646336.239335572,648086.2791965032,649221.8120104092,651733.0192353154,652112.0935428357,653969.179753711,655580.3494427068,658393.0649932115,659197.0550959471,661922.2841264056,663348.0490895815,664788.6696069129,665928.4437253256,668933.5654003982,670219.0894085915,672435.1441485254,674254.2404430934,675295.2338771593,676931.9389980978,678004.4421942441,680813.4058059173,682289.0804062975,683760.6160310346,685349.2540421207,688038.7610266891,689267.0473351999,690044.2845966567,692867.3531149945,694091.7822617397,696426.7605128379,697915.7192243482,699688.9996531581,701293.4253586385,702262.5560389161,703815.2501074633,705826.8206538586,708325.4962123404,709877.961270284,710780.5092569572,713094.8224265013,715279.0978081924,715967.6406513803,718691.6291559413,719421.056146365,722084.3325813904,723631.492227222,724902.503576842,726662.9451299297,728728.7062082144,731006.8821182909,731453.3008945928,732781.3949147706,734988.5748285853,736616.9296131044,739469.6285963188,740283.5464702278,741354.49630553,743293.3058891359,745581.578482779,747396.3962045697,749119.4909837384,750041.1864959621,751725.3401889285,753884.493358716,756514.9871613192,757519.797125709,758521.1520802422,760954.5404628674,763050.6210849548,764658.418150831,765686.06540465,768205.9595925831,769213.0796194201,771198.7656467574,773890.3304107873,773993.3509254575,775773.8203537819,777790.3402529897,779210.1692201406,780876.2581905463,782653.771680019,784329.6376762844,787595.2831434422,788179.7689917402,790767.0102475818,792491.039331985,792968.6486128662,794580.216264264,797490.9339066214,799254.7535406261,800192.9878534592,802931.6104949521,804015.590942128,805347.3520138009,808076.7580443149,809924.4201370764,810985.5973869079,811729.2487014576,813896.5842579515,815802.9317715138,816856.468343555,818770.8924743615,820758.7685260916,822364.6589650298,824259.2079762715,825547.4969246442,827957.8394246062,829053.1328543146,830858.6488886084,833118.805667325,834859.0641623057,836125.8949169567,839094.2996642682,839413.6929081706,841442.4261752162,842940.6266809535,845875.3548104116,846481.3241512107,848233.7788662459,850130.0882836317,851904.0403708701,852985.1532841285,855682.718702098,857894.9020380984]},{\"data\":[858807.6134483254,861231.2075491115,862150.1763137138,864040.2051508732,864933.1029488259,867373.9135353429,869121.8081944748,870397.8082252332,873060.2735987481,874551.1417117086,875733.9768666145,877453.7362750878,880269.3149930733,881561.199345279,883431.4412271567,883869.8899644229,886200.4017822461,887212.1764762056,889709.8335702816,891744.0550901954,892438.5402718696,895188.3502414387,897315.584590776,897942.6004754382,899261.0121014774,901813.27984622,902925.1615334721,905600.9428068157,906080.244728537,908024.7736545467,911172.3196866806,911998.2208209612,914342.0821945261,914725.0867820695,916464.5226283015,919774.6088522797,919830.2009552304,922286.5079569218,923315.768772155,926092.313530708,927057.8086129156,928717.9204648436,931418.7698318363,932636.5350598322,934653.783128736,935531.9719247184,938356.7575470919,939962.5390311012,941400.0553435051,943327.1648246003,943962.1532105431,946351.471177973,947490.3065526247,950042.4791746467,952141.9157668742,952972.6626208407,954364.9473843839,955942.0654673278,958979.5914474002,959267.9102233704,961853.8642943957,963248.0958253284,965595.9203086687,966553.5801993746,967942.5637715829,970997.0382896285,971843.3116927649,973759.3717724846,975393.1145121641,977976.4189494306,978996.5826955226,980836.190884959,981822.6822607788,984185.5627751285,985055.0610634715,987401.8211655738,988925.4709467508,991078.8547187821,992429.4852369678,994759.9449722293,996102.5293064831,998277.7388908035,999915.0926607505,1001009.5527565758,1002954.1504933517,1005217.9734122765,1005993.8677266049,1007357.8947139247,1009095.4881949316,1010863.5854338281,1013040.1293675117,1015704.8654765987,1016153.5304181427,1018080.520559532,1020624.4692005705,1021780.076517329,1023224.7187302569,1024597.1578649601,1027389.5087942124,1029377.8588572943,1030441.2684308165,1032941.6611216274,1033959.0266334319,1035170.0526409665,1038094.6410616635,1038281.5639009859,1041555.7118028128,1043321.6773088006,1043660.6390094358,1045703.0359435258,1048418.1344233706,1049418.4404579313,1051446.2376009524,1053067.9549405824,1055292.4787067904,1055937.5312204354,1057657.5387666975,1060052.2077502778,1061045.1677577887,1062742.2571796088,1065107.1253240579,1066694.5714299239,1067906.7153849474,1070596.822640473,1071621.6142412021,1072996.0752951403,1075438.9725477502,1076255.908630354,1078032.352137454,1080600.9202807408,1082605.3930362049,1083400.7039881188,1085901.9650434572,1086705.8337116,1089025.0253675897,1090068.6498006887,1091860.8701784227,1093701.1625366563,1095997.6441327492,1097658.3975412287,1099036.875522868,1100080.0590509633,1102003.7667912873,1105056.345424372,1106793.6392058528,1108509.7893877197,1109009.2585416469,1111090.6042168154,1112054.0283584937,1114513.4951469968,1115807.8105007722,1117712.3589333878,1120348.3134491858,1120829.6646138988,1123823.7820015159,1125153.3294518103,1127070.6525877728,1128728.1211600536,1130512.7321586495,1131947.3974608665,1133394.4645224074,1134997.511493526,1136509.4205536058,1138790.4546627738,1139664.060000195,1142568.0776992468,1144211.1404588844,1145213.141412192,1147710.2940391952,1149298.9227049337,1150863.9543540336,1152844.381849099,1154084.0222694827,1155769.0296066205,1157788.7339004413,1159417.4865172328,1160322.788855752,1162985.970733094,1163934.8631496562,1165451.0801124603,1168439.4424316313,1168733.5438260692,1171810.0462727507,1173148.2266665953,1174050.2720020977,1176107.4974501217,1178776.8674707997,1180358.861772127,1182096.7735298527,1182477.0600446174,1184958.583924955,1185939.0053809166,1189183.3024968395,1189827.1606755229,1192330.0879128193,1193911.2164014017,1195588.6379698445,1197054.0327972984,1198757.0581785669,1201124.3643055898,1201728.8772212632,1203321.3159375682,1206259.026112234,1207515.030656583,1208080.1002402224,1209918.8225058955,1213130.415508018,1214259.7168228554,1215195.887804841,1217505.8117402876,1219789.5704414523,1220180.522722343,1223017.046170767,1224684.9142322806,1225259.36939849,1227707.0746750329,1228712.7858897815,1230529.77595657,1232650.2292479349,1235084.2182348792,1236974.1224189259,1238275.0415271185,1239453.1360068829,1241468.3559081731,1243633.4097395034,1244723.4720993375,1247184.7952371468,1247611.2972610644,1250640.6886028913,1252103.7944231604,1253299.0778805192,1254861.1025540973,1257427.9252390189,1258784.3031552148,1260848.6438379267,1261698.6394122967,1264092.2354776384,1265847.2888899674,1266427.9577699334,1269444.4352222215,1270712.8347251732,1272610.041310744,1273333.8685998654,1275336.8956101062,1277267.7225311324,1279707.476096105,1281442.5064195804,1282316.0741058735,1283939.0063750907,1286285.3615240513,1288381.4570110864,1289774.9146433927,1291262.2875660527,1293755.6700358107,1294442.0071271418,1297082.2532037362,1298437.677526845,1299180.757335955,1301063.7096198073,1303018.8525357242,1304757.7820661522,1307096.8709328547,1309040.600431058,1309875.356864771,1311213.385210472,1313835.9167839116,1314945.1059120037,1317287.292977638,1319218.5849509593,1320025.4631959489,1322406.011550775,1324319.1059558897,1325905.7763555932,1327420.6366210172,1329282.8194322167,1330452.7067784541,1332589.1479426008,1334191.8655302036,1335234.4044379436,1338230.122747939,1339279.2516825204,1340327.3530998034,1343249.0861495847,1343704.5786053184,1346274.725902786,1347944.7118127663,1350490.064896853,1351665.7015763435,1352260.3957814705,1355250.3672545524,1355946.6283643611,1358038.529079059,1359135.7450185257,1361602.1403755147,1363919.6162871453,1365704.6143336226,1367456.1467602851,1367991.8427756666,1370589.3379907985,1372072.760328367,1374135.262130703,1375230.7701622928,1377235.4707657085,1379528.7781953241,1380130.6583360506,1382551.655164138,1384193.42155001,1385542.1531613711,1387079.9681735644,1389395.9418766112,1391504.2194145839,1392086.6143169573,1394071.8079683664,1395971.169172919,1397749.2109516077,1399521.3440967682,1401112.1889553207,1402615.8019096926,1403912.6640200166,1406467.9249162592,1408407.3036411672,1410370.0238752784,1411916.8422570948,1413437.1099916582,1414943.3362862885,1416840.8076634,1417785.1938366937,1420105.1178491437,1421387.3427246348,1423652.002661006,1425198.0062864604,1426223.3889557288,1429344.2629788115,1430105.2319684394,1431539.210498638,1434108.6056461846,1435803.7760483047,1436585.0666695163,1438236.9737084382,1440821.265097166,1443048.9741500663,1443974.2448927353,1446482.3043724566,1446833.2082074839,1449428.7299904283,1450897.629740599,1452889.0978749688,1454495.2458027133,1455989.1485181954,1457211.1512924216,1459995.8846833608,1460693.3864679686,1462332.64029002,1464350.1526631257,1467135.9987946576,1467630.159033334,1469033.9227493498,1470714.3616971616,1472854.9677452664,1475046.1355789308,1476742.6499903214,1477750.1354289288,1479367.630879295,1482325.9994529681,1483566.3916127612,1484586.6750995854,1486666.825535893,1488153.3658255977,1489555.325258462,1491555.585259371,1493672.4380244336,1495141.050910187,1497793.2775511914,1499516.4517903195,1500444.197605725,1502492.5988676562,1503786.6419630973,1506177.0384597864,1507909.7988754371,1509354.6138217556,1510841.2224878054,1512771.2538495124,1514041.7706457374,1516101.808097858,1517031.1958726328,1519925.2144190678,1521679.9655715148,1522193.665246391,1523814.1549526227,1526989.5321906575,1527737.6272835988,1529405.2306672696,1531231.5902124185,1532708.379847941,1534811.6989086433,1537276.7801082295,1537711.1860783468,1540620.9375758297,1541398.3683693227,1544199.9798827954,1544403.953098318,1546852.5014325613,1548600.8033800996,1549997.6414989317,1551965.4868199741,1554502.8341273807,1555379.6112533964,1557652.2854104785,1559182.5381887073,1560278.2645750623,1561869.7646903102,1563823.4681983034,1566077.600548888,1567713.5933561036,1568878.5678197504,1571741.1900029853,1573119.3621078974,1575154.037279871,1576655.693520369,1577508.6874318635,1580381.6431073446,1580888.246911283,1582180.404405809,1584104.5306066924,1586459.830691733,1588944.8562565132,1589294.7779747166,1591761.181299293,1594127.8441800005,1594723.075804156,1595941.0876660529,1598743.032017021,1600052.3085672567,1602130.5140036664,1603160.448551263,1605391.4347771262,1606357.8827715756,1608984.7150133827,1609658.4193168052,1611383.3411547823,1614230.5840788311,1615518.8250063537,1617373.4580516673,1619451.9133844264,1620330.470071963,1622620.3506487214,1623627.9622716564,1625973.8302216772,1627925.183088148,1629977.14890329,1630315.0801334048,1632266.9987344302,1633807.6326385231,1635994.5884920023,1637097.562115273,1639095.9968204962,1641120.4850029612,1642958.2486156297,1644007.6293166918,1646434.8101248313,1647705.1492663622,1649843.571666941,1651207.1665400735,1653055.2888762592,1655623.5936286596,1657217.562304165,1659287.5056236945,1659547.2401467676,1662547.5944891237,1662829.9260395288,1665137.6459647564,1667304.1829935934,1669539.9166961315,1671215.9663918966,1672716.9670338668,1674295.5327081026,1675497.4418126023,1676875.110525207,1678345.3186367834,1680647.3440738106,1681871.4062381294,1684623.1082505314,1686609.8328689183,1686837.7311058657,1689440.6801734695,1690702.7516588946,1693311.8829391778,1694207.6942260794,1696626.413936077,1697853.3866700125,1699359.321125049,1701965.324888641,1703140.3960478113,1705355.539667997,1706804.4607535051,1708993.219345911,1709395.1137757318,1712451.6581598732,1714041.2231600126,1715927.4232588338]}]} );</script></div>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(def raw-data (map #(+ (* 22 (+ % (Math/random)) 78)) (range)))\n",
    "(def data-1 (take 500 raw-data))\n",
    "(def data-2 (take 500 (drop 500 raw-data)))\n",
    "\n",
    "(plot-highchart {:chart {:type \"line\"}\n",
    "                 :title {:text \"Plot of random data\"}\n",
    "                 :series [{:data data-1} {:data data-2}]})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Clojure",
   "language": "clojure",
   "name": "clojure"
  },
  "language_info": {
   "file_extension": ".clj",
   "mimetype": "text/x-clojure",
   "name": "clojure",
   "version": "1.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
